load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_js//npm:defs.bzl", "npm_link_package")

# Note: Link the package into node modules for testing. Notably, tests
# of a package generally don't use the associated npm package, to e.g. allow for relative
# imports, but here this is an exception as the package needs to be resolvable at runtime
# to replicate a CLI environment.
npm_link_package(
    name = "node_modules/@angular-devkit/build-angular",
    src = "//packages/angular_devkit/build_angular:pkg",
    package = "@angular-devkit/build-angular",
    root_package = package_name(),
)

copy_to_bin(
    name = "hello-world-lib",
    srcs = glob(["**/*"]) + [
        ":node_modules/@angular-devkit/build-angular",
    ],
    visibility = ["//packages/angular_devkit/build_angular:__pkg__"],
)
